/**
 * Creates a factory of OntologyReaders that use polymorphism to perform the appropriate actions
 * This class is package-private because it should not be instantiated by the user, but only by the OntologyController
 * See OntologyController.java if you want to use the factory
 */

package uhasselt.ontologyplugin;

import java.util.HashMap;
import java.util.Map;

class OntologyFactory 
{
	private Map<String, OntologyReader> _readers;
	
	public OntologyFactory()
	{
		_readers = new HashMap<String, OntologyReader>();
	}
	
	/**
	 * Returns a reference to the OntologyReader that the key thesaurus is mapped to 
	 * @param thesaurus The key
	 * @return OntologyReader which key maps to
	 */
	public OntologyReader getReader(String thesaurus)
	{
		return _readers.get(thesaurus);
	}
	
	/**
	 * Add a reader to the factory
	 * @param key The key
	 * @param reader A reference to the reader, the value
	 */
	public void addReader(String key, OntologyReader reader)
	{
		_readers.put(key, reader);
	}
}
